﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Collections;
using System.Data;

namespace DataAccess
{
    public class AdminDAO
    {
        ConnectionDatabase conn;
        public AdminDAO()
        {
            conn = new ConnectionDatabase();
        }
        public string LoginAdmin(string UserName, string PassWord)
        {
            string Name;
            SqlConnection con = conn.GetConnection();
            try {
                con.Open();
                SqlCommand comm = new SqlCommand("SP_LoginAdmin",con);
                comm.CommandType = CommandType.StoredProcedure;
                comm.Parameters.Add("@UserName",SqlDbType.VarChar).Value=UserName;
                comm.Parameters.Add("@PassWord", SqlDbType.VarChar).Value = PassWord;
                SqlDataReader dr = comm.ExecuteReader();
                if (dr.Read())
                {
                    Name = dr.GetString(1);
                    return Name;
                }
                else
                {
                    Name = null;
                    return Name;
                }
            }
            catch (Exception e) { throw; }
            finally { con.Close(); }
           
        }
    }
}
